package com.example.demo;

import com.example.demo.dao.UserDoMapper;
import com.example.demo.dataObject.UserDo;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
@Slf4j
@MapperScan({"com.example.demo.dao","com.example.demo.easy.dao"})
public class DemoApplication  {
    @Autowired
    private UserDoMapper userDoMapper;

    @RequestMapping("/home")
    public String home(){

        UserDo userDo1=userDoMapper.selectByPrimaryKey(1);
        if (userDo1!=null){
            return userDo1.getName();
        }else {
            return "buxunzai 33";
        }
    }
    public static void main(String[] args) {
        System.out.println("123test");
        log.info("123");
        ConfigurableApplicationContext run= SpringApplication.run(DemoApplication.class, args);
        boolean user=run.containsBean("userDao");
        System.out.println(user);
    }
}
